package com.selfdiscipline.ui.screens.timer

import kotlin.time.Duration

/**
 * 格式化时间为小时:分钟:秒格式
 * 
 * @param duration 要格式化的时间
 * @return 格式化后的时间字符串，如 "01:30:45"
 */
fun formatTimeHoursMinutes(duration: Duration): String {
    val hours = duration.inWholeHours
    val minutes = (duration.inWholeMinutes % 60)
    val seconds = (duration.inWholeSeconds % 60)
    
    return if (hours > 0) {
        String.format("%02d:%02d:%02d", hours, minutes, seconds)
    } else {
        String.format("%02d:%02d", minutes, seconds)
    }
} 